package site.codeblog.designpattern.factory.befor;

public class CoffeeStore {

    public void orderCoffee(String type) {

        Coffee coffee = null;

        if ("black".equals(type)) {

            coffee = new BlackCoffee();

        } else if ("milk".equals(type)) {

            coffee = new MilkCoffee();

        } else {
            throw new RuntimeException("没有这种咖啡");
        }

        coffee.getType();
        coffee.addMilk();
        coffee.addSugar();
    }
}
